#ifndef CAMERA_CONTROL_H
#define CAMERA_CONTROL_H

#include <string>
#include "httplib.h"
#include <exception>
#include <nlohmann/json.hpp>
#include <list>
#include <sstream>

class CameraControlException : std::exception
{
  public:
    CameraControlException(std::string msg);
    virtual const char* what() const noexcept override;
  private:
    std::string message;
};

class CameraControl
{
  public:
    CameraControl(std::string CameraIP);
    virtual ~CameraControl();

    void OpenSession();
    nlohmann::json GetCameraInfo();
    
    //模式切换
    enum class Mode {Record,Play,Ready};
    Mode GetMode();
    void RecordMode();

    //录制控制
    void StartRecord();
    void StopRecord();

    //获取相机ID,这里直接返回SN序列号，相机前缀由外部添加
    std::string GetSerialNumber();

    //流控制
    enum class Stream {Stream0,Stream1};
    void SetStreamSource(Stream stream);
    nlohmann::json GetStreamPara(Stream stream);

  private:
    httplib::Client webClient;
};

#endif
